using System;
using System.Collections.Generic;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using DslCrossModelFramework.ModelRelationship;
using DslCrossModelFramework.ModelTraversal;
using Microsoft.VisualStudio.Modeling;
using Microsoft.VisualStudio.Modeling.Design;

namespace DslCrossModelFramework.UI {

    public delegate IEnumerable<IModelRelationshipDefinition> RelationshipDefinitionDelegate(DomainClassInfo parent, string scope);

    public class ModelElementTreeTypeEditor<TRelationshipDefinition> : ModelBrowserDialogTypeEditor where TRelationshipDefinition : IModelRelationshipDefinition, new() {


        protected override IEnumerable<DslCrossModelFramework.ModelRelationship.IModelRelationshipDefinition> GetModelRelationships(DomainClassInfo parent, string scope) {
            List<IModelRelationshipDefinition> modelRelationships = new List<IModelRelationshipDefinition>();
            foreach (Type melRootType in this.Manager.GetModelDirectory().GetAllModelTypes()) {
                TRelationshipDefinition currentRelDef = new TRelationshipDefinition();
                currentRelDef.ModelRootType = melRootType;
                modelRelationships.Add(currentRelDef);
            }

            return modelRelationships;
        }
    }
}